package com.qfedu.fmmall.apiuserlogin.controller;

import com.qfedu.fmmall.apiuserlogin.service.UserLoginService;
import com.qfedu.fmmall.common.vo.ResultVO;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @author : yanBin
 * @date :2022/1/20 15:08
 */
@RestController
@CrossOrigin
@RequestMapping("/user")
@Api(value = "用户注册登录接口",tags = "用户管理接口")
public class UserLoginController {

    @Resource
    private UserLoginService userLoginService;

    @ApiOperation("用户登录接口")
    @ApiImplicitParams({
            @ApiImplicitParam(dataType = "String",name = "username",value = "用户登录账号",required = true),
            @ApiImplicitParam(dataType = "String",name = "password",value = "密码",required = false)})
    @GetMapping("/login")
    public ResultVO login(@RequestParam("username") String username,
                          @RequestParam("password") String password){
        return userLoginService.checkLogin(username, password);
    }
}
